clear all
set more off

cd "~/Box Sync/Replication_AJPS_0215"

use "Levies_Selection.dta"

replace Per_Pupil_Value=Per_Pupil_Value/100000
replace Total_Expend=Total_Expend/1000
replace Instruction_Expend =Instruction_Expend /1000
gen Ln_Enroll2=ln(New_Enroll/1000)

gen levy_dummy=Levy_count>=1
replace levy_dummy=0 if Levy_count==.

gen AYP_Not_Met_2 = .
replace AYP_Not_Met_2 = 1 if AYP == "Not Met"
replace AYP_Not_Met_2 = 0 if AYP == "Met"


tab FY, gen(FY_)
eststo clear 

label variable AYP_Not_Met_2 "AYP Failure"
label variable Millage_Real "Current Millage" 
label variable Per_Pupil_Value "Property Values (per pupil)"
label variable Total_Expend "Tot. Expenditures (per pupil)"
label variable Instruction_Expend "Instructional Expenditures (per pupil)"
label variable PctEnrollBlack "Black (\%)"
label variable PctEnrollHisp "Hispanic(\%)"
label variable LEP_PctEnroll "English-Learners (\%)"

label variable EconDisad_PctEnroll "Poor (\%)"
label variable Disabled_PctEnroll "Disabled (\%)"
label variable Ln_Enroll "District Enrollment (natural log)"

label variable household_privateenrollment_prc "Private School Enrollment (\%)"
label variable housing_own_percent "Owner-Occupied Residence (\%)"

*Table A4 Replication

eststo: xi: reg levy_dummy AYP_Not_Met_2 FY_2-FY_9 Millage_Real Per_Pupil_Value Total_Expend Instruction_Expend PctEnrollBlack  PctEnrollHisp LEP_PctEnroll EconDisad_PctEnroll Disabled_PctEnroll Ln_Enroll2 if FY<2012, vce(cluster IRN)
estadd local Dist_FE "No"
estadd local Year_FE "Yes"
estadd local Ac_Desig "No"


eststo: xi: reg levy_dummy AYP_Not_Met_2 FY_2-FY_9 Millage_Real Per_Pupil_Value Total_Expend Instruction_Expend PctEnrollBlack  PctEnrollHisp LEP_PctEnroll EconDisad_PctEnroll Disabled_PctEnroll Ln_Enroll2 household_privateenrollment_prc housing_own_percent if FY<2012, vce(cluster IRN)

estadd local Dist_FE "No"
estadd local Year_FE "Yes"
estadd local Ac_Desig "No"


tab Designation, gen(DesigFE)


eststo: xi: reg levy_dummy AYP_Not_Met_2 FY_2-FY_9 Millage_Real Per_Pupil_Value Total_Expend Instruction_Expend PctEnrollBlack  PctEnrollHisp LEP_PctEnroll EconDisad_PctEnroll Disabled_PctEnroll Ln_Enroll2 household_privateenrollment_prc housing_own_percent DesigFE2-DesigFE6 if FY<2012, vce(cluster IRN)
estadd local Dist_FE "No"
estadd local Year_FE "Yes"
estadd local Ac_Desig "Yes"


gen election_id = _n
xtset IRN election_id

eststo: xi: xtreg levy_dummy AYP_Not_Met_2 FY_2-FY_9 Millage_Real Per_Pupil_Value Total_Expend Instruction_Expend PctEnrollBlack  PctEnrollHisp LEP_PctEnroll EconDisad_PctEnroll Disabled_PctEnroll Ln_Enroll2 DesigFE2-DesigFE6  if FY<2012,fe vce(cluster IRN)
estadd local Dist_FE "Yes"
estadd local Year_FE "Yes"
estadd local Ac_Desig "Yes"

*esttab using Table_A4.tex, label se star(+ 0.10 * 0.05 ** 0.01 *** 0.001) r2 scalars("Year_FE Year Fixed Effects" "Dist_FE District Fixed Effects" "Ac_Desig Academic Designations") drop(FY_2 FY_3 FY_4 FY_5 FY_6 FY_7 FY_8 FY_9 DesigFE2 DesigFE3 DesigFE4 DesigFE5 DesigFE6 ) title(Linear Probability Models for Levy Presence\label{Tab_Selection}) replace
eststo clear
